 //This file include the declaration of class LineFollower and its variables.
#include <fourwheelbase.h>
#include <Arduino.h>
#include "botconfig.h"

#ifndef _LINE_FOLLOWER_H_
#define _LINE_FOLLOWER_H_

class LineFollower : public Base                                         // class LineFollower is inheriting data from class Base. You can only access public data of Base
{
public:
  void readSensor();                                                    //function to read from sensors
  int calculateError();                                                 //function to Calculate error
  void followLine();
  void flushError();
  int sensorVal(int SensorNum);
public:
//  void  send2Bluetooth(); //Sending Data for Graph Plotting via Bluetooth
//  void  setupBlueToothConnection(); //Setting up Bluetooth Connection
//  float readEEPROM(int address);    //Reading EEPROM memory at given Address
//  int   write2EEPROM(int address,float value); //writing Given value at given EEPROM Address
//  void  checkEEPROM(int value); //check if value are written on EEPROM previously

  void  printSensor();
  void  attachSensor(int lsensor3,int lsensor2,int lsensor1,int csensor,int rsensor1,int rsensor2,int rsensor3);
  void  setK(double kp,double ki,double kd);
public:
  LineFollower();

private:
  int lsensor3;				//pin numbers, are in integers
  int lsensor2;
  int lsensor1;
  int csensor;
  int rsensor1;
  int rsensor2;
  int rsensor3;

  bool lsensor3val;			//status of pin. in 0 or 1
  bool lsensor2val;
  bool lsensor1val;
  bool csensorval;
  bool rsensor1val;
  bool rsensor2val;
  bool rsensor3val;

  int devcount;
  float sumprevdev[5];
  int prevdeviation;
  int totalerror;
  float deviation;
  int error;
  int dt;	//Stores the time interval of the loop
  int prevTime;
  double Kp;
  double Ki;
  double Kd;
};
#endif

